package com.lagou.subjectthree;

import java.math.BigDecimal;

/**
 * 上网套餐类
 */
public class InternetCombo extends Combo implements IInternet {
    /**
     * 上网流量
     */
    private float InternetData;

    /**
     * 上网套餐
     *
     * @param monthCost
     * @param internetData
     */
    public InternetCombo(BigDecimal monthCost, float internetData) {
        super(monthCost);
        setInternetData(internetData);
        System.out.println("上网套餐模块");
    }


    /**
     * 上网功能
     *
     * @param phoneCard
     * @param internetData
     */
    @Override
    public void MakeInternet(PhoneCard phoneCard, float internetData) {
        System.out.println("卡号：" + phoneCard.getCardNum() + "用户名：" + phoneCard.getUserName() + "上网：" + internetData + "MB");
        //消费记录
        UserCostInfo costInfo = new UserCostInfo(phoneCard.getUserName(), 0, internetData, getMonthCost());
        //扣除消费的金额
        phoneCard.setInternetData(phoneCard.getInternetData() + internetData);
        phoneCard.setBalance(phoneCard.getBalance().subtract(getMonthCost()));
    }


    /**
     * 输出套餐信息
     */
    public void ShowComboInfo() {
        System.out.println("上网流量(MB):" + getInternetData() + "  每月费用(元)：" + getMonthCost());
    }


    /**
     * 自定义成员方法实现特征的获取和修改
     *
     * @return
     */
    public float getInternetData() {
        return InternetData;
    }

    public void setInternetData(float internetData) {
        InternetData = internetData;
    }
}
